/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       combat_result.h

	$Header: /game/combat_result.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( COMBAT_RESULT_H_INCLUDED )
#define COMBAT_RESULT_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

enum t_combat_result
{
	k_result_unknown = -1,
	k_result_attacker_lost,
	k_result_attacker_retreated,
	k_result_attacker_surrendered,
	k_result_attacker_escaped,
	k_result_defender_lost,
	k_result_defender_retreated,
	k_result_defender_surrendered,
	k_result_defender_escaped,
	k_result_both_lost
};

enum t_combat_side
{
	k_side_attacker = 0,
	k_side_defender,

	k_side_count
};

inline t_combat_side other_side( t_combat_side side )
{
	if ( side == k_side_attacker )
		return k_side_defender;
	else
		return k_side_attacker;
}

inline bool attacker_lost( t_combat_result result )
{
	return result <= k_result_attacker_escaped || result == k_result_both_lost;
}

inline bool attacker_won( t_combat_result result )
{
	return result >= k_result_defender_lost && result <= k_result_defender_escaped;
}

inline bool defender_lost( t_combat_result result )
{
	return result >= k_result_defender_lost;
}

inline bool defender_won( t_combat_result result )
{
	return result >= k_result_attacker_lost && result <= k_result_attacker_escaped;
}


#endif
